# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=libpostal
pkgver=1.1
pkgrel=0
pkgdesc="A C library for parsing/normalizing street addresses around the world"
url="https://github.com/openvenues/libpostal"
arch="all !armv7" # /tmp/ccFggAdh.s:1377852: Error: conditional branch out of range
license="MIT"
makedepends="autoconf automake libtool"
subpackages="$pkgname-static $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/openvenues/libpostal/archive/v$pkgver.tar.gz"
options="!check" # Requires 100GB of data

prepare() {
	default_prepare

	./bootstrap.sh
}

build() {
	case "$CARCH" in
		x86|x86_64) sse2="--enable-sse2" ;;
		*) sse2="--disable-sse2";;
	esac

	./configure \
		--prefix=/usr \
		--datadir=/usr/local/share \
		--disable-data-download \
		$sse2

	make
}

check() {
	make check
}

package() {
	DESTDIR="$pkgdir" make install
}

sha512sums="a097e0368fe729fa36c6670f87640deba3182fba45832b1e98c45824cc0a346ee172b47942f12845e75dce266d3e51b4ca1fd8b1a4cad24d9c0ef514dc4368db  libpostal-1.1.tar.gz"
